All Questions
Tagged with numpymathematics
20 questions
4votes
1answer
78views
Array Math to Calculate Ice Thickness -- Need Help Simplifying
I posted this on Stack but since it's working code, it was suggested I post it here. I wrote this code to calculate ice thickness using the following equation from Stephenson, 2011. It's a daily ...
2votes
0answers
95views
Python script that generates images using Thue-Morse sequence
In mathematics, the Thue–Morse sequence, or Prouhet–Thue–Morse sequence, is the binary sequence (an infinite sequence of 0s and 1s) obtained by starting with 0 and successively appending the Boolean ...
2votes
1answer
86views
Readable Backprogragation calculations in Numpy Neural Network
As an exercise we should write a small Neural Network with the following structure: There should be additionally a bias for each layer and sigmoid should be used as the activation function. The ...
1vote
1answer
69views
Fixing math library functions in Black-Scholes options pricing model
I've amended a code for the Black-Scholes formula for European pricing options found here at the bottom of the page and fixed the math functions accordingly. Unlike the code on the website, mine has ...
2votes
2answers
2kviews
Solving the TDoA multilateration problem in 3-dimensions
Background. I've written an algorithm to solve the Time Difference of Arrival (TDoA) multilateration problem in 3-dimensions. That is, given the known coordinates of ...
2votes
2answers
790views
Finding distance between vectors of matrices
So here is the problem: Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m respectively and one natural number 'p'. You need to find the distance(Euclidean) of the rows of the matrices 'a' and ...
5votes
1answer
479views
Bancroft's method implementation
Background I've written an algorithm to solve the three-dimensional Time Difference of Arrival (TDoA) multi-lateration problem. That is, given the coordinates of n ...
4votes
1answer
317views
Simulated annealing for magic square-of-squares puzzle
I'm working on a function that takes in a NumPy array containing only mutually distinct positive square numbers. I want the function to pick an element at random, find if there is a lower positive ...
4votes
1answer
540views
Drawing spirals on virtual whiteboards
I have it set up so I place my mouse in the center of where I want the spiral to be, then I press enter to start the program, then define the radius initially and how much it grows each time it goes ...
4votes
2answers
657views
Python numerical integration
Could the time complexity of this definite integral algorithm be improved? ...
2votes
1answer
165views
Calculate the sum over a list of minima of two vectors
I have the following metric: def d(x, y): """The metric.""" return 1 - sum(min(xi, yi) for xi, yi in zip(x, y)) where ...
4votes
1answer
1kviews
Snell's law using Zoeppritz equation by matrices
I have created the following code to calculate Snell's law angles, based on Zoeppritz equations on complex plane. The code works, seems it is returning valid values, but after all the code just looks ...
13votes
2answers
1kviews
Numerics for a game theory calculation using expected utility
I am trying to replicate Bruce B. de Mesquita's (BDM) results on political game theory for prediction. Based on where actors stand on issues, their capabilities, salience, BDM's method attempts to ...
1vote
1answer
167views
Vectorizing in Python [closed]
I have the following code: ...
7votes
1answer
131views
Weighted phase Laplacian formula
We have the following equation (weighted phase Laplacian): \$c_{i,j} = U(i,j)\Delta^{^x}_{i,j} - U(i-l, j)\Delta^{x}_{i-1,j} + V(i,j)\Delta^{y}_{i,j} - V(i,j-1)\Delta^{y}_{i,j-1}\$ Where \$U(i,j) = ...